package com.project.webservice.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.project.webservice.entity.RfidBg;
import com.project.webservice.mapper.RfidBgMapper;
import com.project.webservice.service.RfidBgService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@Service
public class RfidBgServiceImpl extends ServiceImpl<RfidBgMapper, RfidBg> implements RfidBgService {
    /**
     * getriduid
     * @param uid
     * @param top
     * @return
     */
    @DS("rfid")
    public List<RfidBg> selectByTop(String uid, int top){
        log.info("selectByTop:{},{}", uid, top);
        return super.list(Wrappers.<RfidBg>lambdaQuery().eq(RfidBg::getBGNO, uid).last("limit " + top));
    }
}
